﻿/*
Post-Deployment Script Template							
--------------------------------------------------------------------------------------
 This file contains SQL statements that will be appended to the build script.		
 Use SQLCMD syntax to include a file in the post-deployment script.			
 Example:      :r .\myfile.sql								
 Use SQLCMD syntax to reference a variable in the post-deployment script.		
 Example:      :setvar TableName MyTable							
               SELECT * FROM [$(TableName)]					
--------------------------------------------------------------------------------------
*/

  IF NOT EXISTS (SELECT 1 FROM DBO.aspnet_Applications WHERE LoweredApplicationName = 'kanz4kidz')
  BEGIN	
	INSERT INTO dbo.aspnet_Applications (ApplicationName,LoweredApplicationName,ApplicationId,Description)
	VALUES('Kanz4Kidz','kanz4kidz','C61D2533-39C1-4570-8BA8-A50A0554E6DF','Not-4-Profit Website for Kanz4Kidz')	
  END
GO


IF NOT EXISTS(SELECT 1 FROM dbo.aspnet_Users WHERE UserId = '7C94E506-7F99-4641-9179-E6756759D621')
BEGIN
	INSERT INTO [Kanz4Kidz].[dbo].[aspnet_Users]
           ([ApplicationId]
           ,[UserId]
           ,[UserName]
           ,[LoweredUserName]
           ,[MobileAlias]
           ,[IsAnonymous]
           ,[LastActivityDate])
     VALUES
           ('C61D2533-39C1-4570-8BA8-A50A0554E6DF'
           ,'7C94E506-7F99-4641-9179-E6756759D621'
           ,'ryan.r.sites@gmail.com'
           ,'ryan.r.sites@gmail.com'
           ,NULL
           ,0
           ,GETDATE())
END
GO

IF NOT EXISTS (SELECT 1 FROM dbo.aspnet_Membership WHERE UserId = '7C94E506-7F99-4641-9179-E6756759D621')
BEGIN	
	INSERT INTO [Kanz4Kidz].[dbo].[aspnet_Membership]
           ([ApplicationId]
           ,[UserId]
           ,[Password]
           ,[PasswordFormat]
           ,[PasswordSalt]
           ,[MobilePIN]
           ,[Email]
           ,[LoweredEmail]
           ,[PasswordQuestion]
           ,[PasswordAnswer]
           ,[IsApproved]
           ,[IsLockedOut]
           ,[CreateDate]
           ,[LastLoginDate]
           ,[LastPasswordChangedDate]
           ,[LastLockoutDate]
           ,[FailedPasswordAttemptCount]
           ,[FailedPasswordAttemptWindowStart]
           ,[FailedPasswordAnswerAttemptCount]
           ,[FailedPasswordAnswerAttemptWindowStart]
           ,[Comment])
     VALUES
           ('C61D2533-39C1-4570-8BA8-A50A0554E6DF'
           ,'7C94E506-7F99-4641-9179-E6756759D621'
           ,'702Pucr6Bbj9B7EWjvdMWN2w4x8='
           ,1
           ,'jTWmk2c7nLtC0Pn6GHzhIA=='
           ,NULL
           ,'ryan.r.sites@gmail.com'
           ,'ryan.r.sites@gmail.com'
           ,NULL
           ,NULL
           ,1
           ,0
           ,'2013-01-28 17:09:29.000'
           ,'2013-01-28 17:09:29.000'
           ,'2013-01-28 17:09:29.000'
           ,'2013-01-28 17:09:29.000'
           ,0
           ,'2013-01-28 17:09:29.000'
           ,0
           ,'2013-01-28 17:09:29.000'
           ,'Initial Insert')           
    
END
GO

IF NOT EXISTS(SELECT 1 FROM dbo.aspnet_Roles WHERE LoweredRoleName = 'systemadmin')
BEGIN
	INSERT INTO dbo.aspnet_Roles (ApplicationId,RoleName,LoweredRoleName,[Description],RoleId)
	VALUES ('C61D2533-39C1-4570-8BA8-A50A0554E6DF','SystemAdmin','systemadmin','System Administrator','BD80FD38-644A-46DC-9BD7-85FA6A1B7117')
END

IF NOT EXISTS(SELECT 1 FROM dbo.aspnet_Roles WHERE LoweredRoleName = 'member')
BEGIN
	INSERT INTO dbo.aspnet_Roles (ApplicationId,RoleName,LoweredRoleName,[Description],RoleId)
	VALUES ('C61D2533-39C1-4570-8BA8-A50A0554E6DF','Member','member','Kanz4Kid Member','745FE0A3-426F-4996-BE69-75FFD7A2BEE4')
END

IF NOT EXISTS(SELECT 1 FROM dbo.aspnet_Roles WHERE LoweredRoleName = 'chapteradmin')
BEGIN
	INSERT INTO dbo.aspnet_Roles (ApplicationId,RoleName,LoweredRoleName,[Description],RoleId)
	VALUES ('C61D2533-39C1-4570-8BA8-A50A0554E6DF','ChapterAdmin','chapteradmin','Chapter Administrator','D909F128-39F0-4A3A-887B-0DA48DC2C859')
END

GO


IF NOT EXISTS(SELECT 1 FROM dbo.aspnet_UsersInRoles WHERE RoleId = 'BD80FD38-644A-46DC-9BD7-85FA6A1B7117' and UserId = '7C94E506-7F99-4641-9179-E6756759D621')
BEGIN
	INSERT INTO dbo.aspnet_UsersInRoles (RoleId,UserId)
	VALUES ('BD80FD38-644A-46DC-9BD7-85FA6A1B7117','7C94E506-7F99-4641-9179-E6756759D621')
END
GO

